// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Google Cloud Data Catalog API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_datacatalog_v1::client::DataCatalog;
/// let client = DataCatalog::builder().build().await?;
/// // use `client` to make requests to the Google Cloud Data Catalog API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Deprecated: Please use Dataplex Catalog instead.
///
/// Data Catalog API service allows you to discover, understand, and manage
/// your data.
///
/// # Configuration
///
/// To configure `DataCatalog` use the `with_*` methods in the type returned
/// by [builder()][DataCatalog::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://datacatalog.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::data_catalog::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::data_catalog::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `DataCatalog` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `DataCatalog` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
#[deprecated]
pub struct DataCatalog {
    inner: std::sync::Arc<dyn super::stub::dynamic::DataCatalog>,
}

impl DataCatalog {
    /// Returns a builder for [DataCatalog].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_datacatalog_v1::client::DataCatalog;
    /// let client = DataCatalog::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::data_catalog::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::data_catalog::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::DataCatalog + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DataCatalog>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataCatalog> {
        super::transport::DataCatalog::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::DataCatalog> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::DataCatalog::new)
    }

    /// Searches Data Catalog for multiple resources like entries and tags that
    /// match a query.
    ///
    /// This is a [Custom Method]
    /// (<https://cloud.google.com/apis/design/custom_methods>) that doesn't return
    /// all information on a resource, only its ID and high level fields. To get
    /// more information, you can subsequently call specific get methods.
    ///
    /// Note: Data Catalog search queries don't guarantee full recall. Results
    /// that match your query might not be returned, even in subsequent
    /// result pages. Additionally, returned (and not returned) results can vary
    /// if you repeat search queries.
    ///
    /// For more information, see [Data Catalog search syntax]
    /// (<https://cloud.google.com/data-catalog/docs/how-to/search-reference>).
    #[deprecated]
    pub fn search_catalog(&self) -> super::builder::data_catalog::SearchCatalog {
        super::builder::data_catalog::SearchCatalog::new(self.inner.clone())
    }

    /// Creates an entry group.
    ///
    /// An entry group contains logically related entries together with [Cloud
    /// Identity and Access Management](/data-catalog/docs/concepts/iam) policies.
    /// These policies specify users who can create, edit, and view entries
    /// within entry groups.
    ///
    /// Data Catalog automatically creates entry groups with names that start with
    /// the `@` symbol for the following resources:
    ///
    /// * BigQuery entries (`@bigquery`)
    /// * Pub/Sub topics (`@pubsub`)
    /// * Dataproc Metastore services (`@dataproc_metastore_{SERVICE_NAME_HASH}`)
    ///
    /// You can create your own entry groups for Cloud Storage fileset entries
    /// and custom entries together with the corresponding IAM policies.
    /// User-created entry groups can't contain the `@` symbol, it is reserved
    /// for automatically created groups.
    ///
    /// Entry groups, like entries, can be searched.
    ///
    /// A maximum of 10,000 entry groups may be created per organization across all
    /// locations.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `parent` parameter. For more information, see [Data Catalog resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn create_entry_group(&self) -> super::builder::data_catalog::CreateEntryGroup {
        super::builder::data_catalog::CreateEntryGroup::new(self.inner.clone())
    }

    /// Gets an entry group.
    #[deprecated]
    pub fn get_entry_group(&self) -> super::builder::data_catalog::GetEntryGroup {
        super::builder::data_catalog::GetEntryGroup::new(self.inner.clone())
    }

    /// Updates an entry group.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `entry_group.name` parameter. For more information, see [Data Catalog
    /// resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn update_entry_group(&self) -> super::builder::data_catalog::UpdateEntryGroup {
        super::builder::data_catalog::UpdateEntryGroup::new(self.inner.clone())
    }

    /// Deletes an entry group.
    ///
    /// You must enable the Data Catalog API in the project
    /// identified by the `name` parameter. For more information, see [Data Catalog
    /// resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn delete_entry_group(&self) -> super::builder::data_catalog::DeleteEntryGroup {
        super::builder::data_catalog::DeleteEntryGroup::new(self.inner.clone())
    }

    /// Lists entry groups.
    #[deprecated]
    pub fn list_entry_groups(&self) -> super::builder::data_catalog::ListEntryGroups {
        super::builder::data_catalog::ListEntryGroups::new(self.inner.clone())
    }

    /// Creates an entry.
    ///
    /// You can create entries only with 'FILESET', 'CLUSTER', 'DATA_STREAM',
    /// or custom types. Data Catalog automatically creates entries with other
    /// types during metadata ingestion from integrated systems.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `parent` parameter. For more information, see [Data Catalog resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    ///
    /// An entry group can have a maximum of 100,000 entries.
    #[deprecated]
    pub fn create_entry(&self) -> super::builder::data_catalog::CreateEntry {
        super::builder::data_catalog::CreateEntry::new(self.inner.clone())
    }

    /// Updates an existing entry.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `entry.name` parameter. For more information, see [Data Catalog
    /// resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn update_entry(&self) -> super::builder::data_catalog::UpdateEntry {
        super::builder::data_catalog::UpdateEntry::new(self.inner.clone())
    }

    /// Deletes an existing entry.
    ///
    /// You can delete only the entries created by the
    /// [CreateEntry][google.cloud.datacatalog.v1.DataCatalog.CreateEntry]
    /// method.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `name` parameter. For more information, see [Data Catalog
    /// resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    ///
    /// [google.cloud.datacatalog.v1.DataCatalog.CreateEntry]: crate::client::DataCatalog::create_entry
    #[deprecated]
    pub fn delete_entry(&self) -> super::builder::data_catalog::DeleteEntry {
        super::builder::data_catalog::DeleteEntry::new(self.inner.clone())
    }

    /// Gets an entry.
    #[deprecated]
    pub fn get_entry(&self) -> super::builder::data_catalog::GetEntry {
        super::builder::data_catalog::GetEntry::new(self.inner.clone())
    }

    /// Gets an entry by its target resource name.
    ///
    /// The resource name comes from the source Google Cloud Platform service.
    #[deprecated]
    pub fn lookup_entry(&self) -> super::builder::data_catalog::LookupEntry {
        super::builder::data_catalog::LookupEntry::new(self.inner.clone())
    }

    /// Lists entries.
    ///
    /// Note: Currently, this method can list only custom entries.
    /// To get a list of both custom and automatically created entries, use
    /// [SearchCatalog][google.cloud.datacatalog.v1.DataCatalog.SearchCatalog].
    ///
    /// [google.cloud.datacatalog.v1.DataCatalog.SearchCatalog]: crate::client::DataCatalog::search_catalog
    #[deprecated]
    pub fn list_entries(&self) -> super::builder::data_catalog::ListEntries {
        super::builder::data_catalog::ListEntries::new(self.inner.clone())
    }

    /// Modifies entry overview, part of the business context of an
    /// [Entry][google.cloud.datacatalog.v1.Entry].
    ///
    /// To call this method, you must have the `datacatalog.entries.updateOverview`
    /// IAM permission on the corresponding project.
    ///
    /// [google.cloud.datacatalog.v1.Entry]: crate::model::Entry
    #[deprecated]
    pub fn modify_entry_overview(&self) -> super::builder::data_catalog::ModifyEntryOverview {
        super::builder::data_catalog::ModifyEntryOverview::new(self.inner.clone())
    }

    /// Modifies contacts, part of the business context of an
    /// [Entry][google.cloud.datacatalog.v1.Entry].
    ///
    /// To call this method, you must have the `datacatalog.entries.updateContacts`
    /// IAM permission on the corresponding project.
    ///
    /// [google.cloud.datacatalog.v1.Entry]: crate::model::Entry
    #[deprecated]
    pub fn modify_entry_contacts(&self) -> super::builder::data_catalog::ModifyEntryContacts {
        super::builder::data_catalog::ModifyEntryContacts::new(self.inner.clone())
    }

    /// Creates a tag template.
    ///
    /// You must enable the Data Catalog API in the project identified by the
    /// `parent` parameter.
    /// For more information, see [Data Catalog resource project]
    /// (<https://cloud.google.com/data-catalog/docs/concepts/resource-project>).
    #[deprecated]
    pub fn create_tag_template(&self) -> super::builder::data_catalog::CreateTagTemplate {
        super::builder::data_catalog::CreateTagTemplate::new(self.inner.clone())
    }

    /// Gets a tag template.
    #[deprecated]
    pub fn get_tag_template(&self) -> super::builder::data_catalog::GetTagTemplate {
        super::builder::data_catalog::GetTagTemplate::new(self.inner.clone())
    }

    /// Updates a tag template.
    ///
    /// You can't update template fields with this method. These fields are
    /// separate resources with their own create, update, and delete methods.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `tag_template.name` parameter. For more information, see [Data Catalog
    /// resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn update_tag_template(&self) -> super::builder::data_catalog::UpdateTagTemplate {
        super::builder::data_catalog::UpdateTagTemplate::new(self.inner.clone())
    }

    /// Deletes a tag template and all tags that use it.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `name` parameter. For more information, see [Data Catalog resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn delete_tag_template(&self) -> super::builder::data_catalog::DeleteTagTemplate {
        super::builder::data_catalog::DeleteTagTemplate::new(self.inner.clone())
    }

    /// Creates a field in a tag template.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `parent` parameter. For more information, see [Data Catalog resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn create_tag_template_field(
        &self,
    ) -> super::builder::data_catalog::CreateTagTemplateField {
        super::builder::data_catalog::CreateTagTemplateField::new(self.inner.clone())
    }

    /// Updates a field in a tag template.
    ///
    /// You can't update the field type with this method.
    ///
    /// You must enable the Data Catalog API in the project
    /// identified by the `name` parameter. For more information, see [Data Catalog
    /// resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn update_tag_template_field(
        &self,
    ) -> super::builder::data_catalog::UpdateTagTemplateField {
        super::builder::data_catalog::UpdateTagTemplateField::new(self.inner.clone())
    }

    /// Renames a field in a tag template.
    ///
    /// You must enable the Data Catalog API in the project identified by the
    /// `name` parameter. For more information, see [Data Catalog resource project]
    /// (<https://cloud.google.com/data-catalog/docs/concepts/resource-project>).
    #[deprecated]
    pub fn rename_tag_template_field(
        &self,
    ) -> super::builder::data_catalog::RenameTagTemplateField {
        super::builder::data_catalog::RenameTagTemplateField::new(self.inner.clone())
    }

    /// Renames an enum value in a tag template.
    ///
    /// Within a single enum field, enum values must be unique.
    #[deprecated]
    pub fn rename_tag_template_field_enum_value(
        &self,
    ) -> super::builder::data_catalog::RenameTagTemplateFieldEnumValue {
        super::builder::data_catalog::RenameTagTemplateFieldEnumValue::new(self.inner.clone())
    }

    /// Deletes a field in a tag template and all uses of this field from the tags
    /// based on this template.
    ///
    /// You must enable the Data Catalog API in the project identified by
    /// the `name` parameter. For more information, see [Data Catalog resource
    /// project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
    #[deprecated]
    pub fn delete_tag_template_field(
        &self,
    ) -> super::builder::data_catalog::DeleteTagTemplateField {
        super::builder::data_catalog::DeleteTagTemplateField::new(self.inner.clone())
    }

    /// Creates a tag and assigns it to:
    ///
    /// * An [Entry][google.cloud.datacatalog.v1.Entry] if the method name is
    ///   `projects.locations.entryGroups.entries.tags.create`.
    /// * Or [EntryGroup][google.cloud.datacatalog.v1.EntryGroup]if the method
    ///   name is `projects.locations.entryGroups.tags.create`.
    ///
    /// Note: The project identified by the `parent` parameter for the [tag]
    /// (<https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters>)
    /// and the [tag template]
    /// (<https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.tagTemplates/create#path-parameters>)
    /// used to create the tag must be in the same organization.
    ///
    /// [google.cloud.datacatalog.v1.Entry]: crate::model::Entry
    /// [google.cloud.datacatalog.v1.EntryGroup]: crate::model::EntryGroup
    #[deprecated]
    pub fn create_tag(&self) -> super::builder::data_catalog::CreateTag {
        super::builder::data_catalog::CreateTag::new(self.inner.clone())
    }

    /// Updates an existing tag.
    #[deprecated]
    pub fn update_tag(&self) -> super::builder::data_catalog::UpdateTag {
        super::builder::data_catalog::UpdateTag::new(self.inner.clone())
    }

    /// Deletes a tag.
    #[deprecated]
    pub fn delete_tag(&self) -> super::builder::data_catalog::DeleteTag {
        super::builder::data_catalog::DeleteTag::new(self.inner.clone())
    }

    /// Lists tags assigned to an [Entry][google.cloud.datacatalog.v1.Entry].
    /// The [columns][google.cloud.datacatalog.v1.Tag.column] in the response are
    /// lowercased.
    ///
    /// [google.cloud.datacatalog.v1.Entry]: crate::model::Entry
    /// [google.cloud.datacatalog.v1.Tag.column]: crate::model::Tag::scope
    #[deprecated]
    pub fn list_tags(&self) -> super::builder::data_catalog::ListTags {
        super::builder::data_catalog::ListTags::new(self.inner.clone())
    }

    /// `ReconcileTags` creates or updates a list of tags on the entry.
    /// If the
    /// [ReconcileTagsRequest.force_delete_missing][google.cloud.datacatalog.v1.ReconcileTagsRequest.force_delete_missing]
    /// parameter is set, the operation deletes tags not included in the input tag
    /// list.
    ///
    /// `ReconcileTags` returns a [long-running operation]
    /// [google.longrunning.Operation] resource that can be queried with
    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation]
    /// to return [ReconcileTagsMetadata]
    /// [google.cloud.datacatalog.v1.ReconcileTagsMetadata] and
    /// a [ReconcileTagsResponse]
    /// [google.cloud.datacatalog.v1.ReconcileTagsResponse] message.
    ///
    /// [google.cloud.datacatalog.v1.ReconcileTagsRequest.force_delete_missing]: crate::model::ReconcileTagsRequest::force_delete_missing
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    #[deprecated]
    pub fn reconcile_tags(&self) -> super::builder::data_catalog::ReconcileTags {
        super::builder::data_catalog::ReconcileTags::new(self.inner.clone())
    }

    /// Marks an [Entry][google.cloud.datacatalog.v1.Entry] as starred by
    /// the current user. Starring information is private to each user.
    ///
    /// [google.cloud.datacatalog.v1.Entry]: crate::model::Entry
    #[deprecated]
    pub fn star_entry(&self) -> super::builder::data_catalog::StarEntry {
        super::builder::data_catalog::StarEntry::new(self.inner.clone())
    }

    /// Marks an [Entry][google.cloud.datacatalog.v1.Entry] as NOT starred by
    /// the current user. Starring information is private to each user.
    ///
    /// [google.cloud.datacatalog.v1.Entry]: crate::model::Entry
    #[deprecated]
    pub fn unstar_entry(&self) -> super::builder::data_catalog::UnstarEntry {
        super::builder::data_catalog::UnstarEntry::new(self.inner.clone())
    }

    /// Sets an access control policy for a resource. Replaces any existing
    /// policy.
    ///
    /// Supported resources are:
    ///
    /// - Tag templates
    /// - Entry groups
    ///
    /// Note: This method sets policies only within Data Catalog and can't be
    /// used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any
    /// external Google Cloud Platform resources synced with the Data Catalog.
    ///
    /// To call this method, you must have the following Google IAM permissions:
    ///
    /// - `datacatalog.tagTemplates.setIamPolicy` to set policies on tag
    ///   templates.
    /// - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
    #[deprecated]
    pub fn set_iam_policy(&self) -> super::builder::data_catalog::SetIamPolicy {
        super::builder::data_catalog::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a resource.
    ///
    /// May return:
    ///
    /// * A`NOT_FOUND` error if the resource doesn't exist or you don't have the
    ///   permission to view it.
    /// * An empty policy if the resource exists but doesn't have a set policy.
    ///
    /// Supported resources are:
    ///
    /// - Tag templates
    /// - Entry groups
    ///
    /// Note: This method doesn't get policies from Google Cloud Platform
    /// resources ingested into Data Catalog.
    ///
    /// To call this method, you must have the following Google IAM permissions:
    ///
    /// - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag
    ///   templates.
    /// - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
    #[deprecated]
    pub fn get_iam_policy(&self) -> super::builder::data_catalog::GetIamPolicy {
        super::builder::data_catalog::GetIamPolicy::new(self.inner.clone())
    }

    /// Gets your permissions on a resource.
    ///
    /// Returns an empty set of permissions if the resource doesn't exist.
    ///
    /// Supported resources are:
    ///
    /// - Tag templates
    /// - Entry groups
    ///
    /// Note: This method gets policies only within Data Catalog and can't be
    /// used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any
    /// external Google Cloud Platform resources ingested into Data Catalog.
    ///
    /// No Google IAM permissions are required to call this method.
    #[deprecated]
    pub fn test_iam_permissions(&self) -> super::builder::data_catalog::TestIamPermissions {
        super::builder::data_catalog::TestIamPermissions::new(self.inner.clone())
    }

    /// Imports entries from a source, such as data previously dumped into a
    /// Cloud Storage bucket, into Data Catalog. Import of entries
    /// is a sync operation that reconciles the state of the third-party system
    /// with the Data Catalog.
    ///
    /// `ImportEntries` accepts source data snapshots of a third-party system.
    /// Snapshot should be delivered as a .wire or base65-encoded .txt file
    /// containing a sequence of Protocol Buffer messages of
    /// [DumpItem][google.cloud.datacatalog.v1.DumpItem] type.
    ///
    /// `ImportEntries` returns a [long-running operation]
    /// [google.longrunning.Operation] resource that can be queried with
    /// [Operations.GetOperation][google.longrunning.Operations.GetOperation]
    /// to return
    /// [ImportEntriesMetadata][google.cloud.datacatalog.v1.ImportEntriesMetadata]
    /// and an
    /// [ImportEntriesResponse][google.cloud.datacatalog.v1.ImportEntriesResponse]
    /// message.
    ///
    /// [google.cloud.datacatalog.v1.DumpItem]: crate::model::DumpItem
    /// [google.cloud.datacatalog.v1.ImportEntriesMetadata]: crate::model::ImportEntriesMetadata
    /// [google.cloud.datacatalog.v1.ImportEntriesResponse]: crate::model::ImportEntriesResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    #[deprecated]
    pub fn import_entries(&self) -> super::builder::data_catalog::ImportEntries {
        super::builder::data_catalog::ImportEntries::new(self.inner.clone())
    }

    /// Sets the configuration related to the migration to Dataplex for an
    /// organization or project.
    #[deprecated]
    pub fn set_config(&self) -> super::builder::data_catalog::SetConfig {
        super::builder::data_catalog::SetConfig::new(self.inner.clone())
    }

    /// Retrieves the configuration related to the migration from Data Catalog to
    /// Dataplex for a specific organization, including all the projects under it
    /// which have a separate configuration set.
    #[deprecated]
    pub fn retrieve_config(&self) -> super::builder::data_catalog::RetrieveConfig {
        super::builder::data_catalog::RetrieveConfig::new(self.inner.clone())
    }

    /// Retrieves the effective configuration related to the migration from Data
    /// Catalog to Dataplex for a specific organization or project. If there is no
    /// specific configuration set for the resource, the setting is checked
    /// hierarchicahlly through the ancestors of the resource, starting from the
    /// resource itself.
    #[deprecated]
    pub fn retrieve_effective_config(
        &self,
    ) -> super::builder::data_catalog::RetrieveEffectiveConfig {
        super::builder::data_catalog::RetrieveEffectiveConfig::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::data_catalog::ListOperations {
        super::builder::data_catalog::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::data_catalog::GetOperation {
        super::builder::data_catalog::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::data_catalog::DeleteOperation {
        super::builder::data_catalog::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::data_catalog::CancelOperation {
        super::builder::data_catalog::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Google Cloud Data Catalog API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_datacatalog_v1::client::PolicyTagManager;
/// let client = PolicyTagManager::builder().build().await?;
/// // use `client` to make requests to the Google Cloud Data Catalog API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Policy Tag Manager API service allows you to manage your policy tags and
/// taxonomies.
///
/// Policy tags are used to tag BigQuery columns and apply additional access
/// control policies. A taxonomy is a hierarchical grouping of policy tags that
/// classify data along a common axis.
///
/// # Configuration
///
/// To configure `PolicyTagManager` use the `with_*` methods in the type returned
/// by [builder()][PolicyTagManager::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://datacatalog.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::policy_tag_manager::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::policy_tag_manager::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `PolicyTagManager` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `PolicyTagManager` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct PolicyTagManager {
    inner: std::sync::Arc<dyn super::stub::dynamic::PolicyTagManager>,
}

impl PolicyTagManager {
    /// Returns a builder for [PolicyTagManager].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_datacatalog_v1::client::PolicyTagManager;
    /// let client = PolicyTagManager::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::policy_tag_manager::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::policy_tag_manager::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::PolicyTagManager + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PolicyTagManager>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PolicyTagManager> {
        super::transport::PolicyTagManager::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PolicyTagManager> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::PolicyTagManager::new)
    }

    /// Creates a taxonomy in a specified project.
    ///
    /// The taxonomy is initially empty, that is, it doesn't contain policy tags.
    pub fn create_taxonomy(&self) -> super::builder::policy_tag_manager::CreateTaxonomy {
        super::builder::policy_tag_manager::CreateTaxonomy::new(self.inner.clone())
    }

    /// Deletes a taxonomy, including all policy tags in this
    /// taxonomy, their associated policies, and the policy tags references from
    /// BigQuery columns.
    pub fn delete_taxonomy(&self) -> super::builder::policy_tag_manager::DeleteTaxonomy {
        super::builder::policy_tag_manager::DeleteTaxonomy::new(self.inner.clone())
    }

    /// Updates a taxonomy, including its display name,
    /// description, and activated policy types.
    pub fn update_taxonomy(&self) -> super::builder::policy_tag_manager::UpdateTaxonomy {
        super::builder::policy_tag_manager::UpdateTaxonomy::new(self.inner.clone())
    }

    /// Lists all taxonomies in a project in a particular location that you
    /// have a permission to view.
    pub fn list_taxonomies(&self) -> super::builder::policy_tag_manager::ListTaxonomies {
        super::builder::policy_tag_manager::ListTaxonomies::new(self.inner.clone())
    }

    /// Gets a taxonomy.
    pub fn get_taxonomy(&self) -> super::builder::policy_tag_manager::GetTaxonomy {
        super::builder::policy_tag_manager::GetTaxonomy::new(self.inner.clone())
    }

    /// Creates a policy tag in a taxonomy.
    pub fn create_policy_tag(&self) -> super::builder::policy_tag_manager::CreatePolicyTag {
        super::builder::policy_tag_manager::CreatePolicyTag::new(self.inner.clone())
    }

    /// Deletes a policy tag together with the following:
    ///
    /// * All of its descendant policy tags, if any
    /// * Policies associated with the policy tag and its descendants
    /// * References from BigQuery table schema of the policy tag and its
    ///   descendants
    pub fn delete_policy_tag(&self) -> super::builder::policy_tag_manager::DeletePolicyTag {
        super::builder::policy_tag_manager::DeletePolicyTag::new(self.inner.clone())
    }

    /// Updates a policy tag, including its display
    /// name, description, and parent policy tag.
    pub fn update_policy_tag(&self) -> super::builder::policy_tag_manager::UpdatePolicyTag {
        super::builder::policy_tag_manager::UpdatePolicyTag::new(self.inner.clone())
    }

    /// Lists all policy tags in a taxonomy.
    pub fn list_policy_tags(&self) -> super::builder::policy_tag_manager::ListPolicyTags {
        super::builder::policy_tag_manager::ListPolicyTags::new(self.inner.clone())
    }

    /// Gets a policy tag.
    pub fn get_policy_tag(&self) -> super::builder::policy_tag_manager::GetPolicyTag {
        super::builder::policy_tag_manager::GetPolicyTag::new(self.inner.clone())
    }

    /// Gets the IAM policy for a policy tag or a taxonomy.
    pub fn get_iam_policy(&self) -> super::builder::policy_tag_manager::GetIamPolicy {
        super::builder::policy_tag_manager::GetIamPolicy::new(self.inner.clone())
    }

    /// Sets the IAM policy for a policy tag or a taxonomy.
    pub fn set_iam_policy(&self) -> super::builder::policy_tag_manager::SetIamPolicy {
        super::builder::policy_tag_manager::SetIamPolicy::new(self.inner.clone())
    }

    /// Returns your permissions on a specified policy tag or
    /// taxonomy.
    pub fn test_iam_permissions(&self) -> super::builder::policy_tag_manager::TestIamPermissions {
        super::builder::policy_tag_manager::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::policy_tag_manager::ListOperations {
        super::builder::policy_tag_manager::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::policy_tag_manager::GetOperation {
        super::builder::policy_tag_manager::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::policy_tag_manager::DeleteOperation {
        super::builder::policy_tag_manager::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::policy_tag_manager::CancelOperation {
        super::builder::policy_tag_manager::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Google Cloud Data Catalog API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_datacatalog_v1::client::PolicyTagManagerSerialization;
/// let client = PolicyTagManagerSerialization::builder().build().await?;
/// // use `client` to make requests to the Google Cloud Data Catalog API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Policy Tag Manager Serialization API service allows you to manipulate
/// your policy tags and taxonomies in a serialized format.
///
/// Taxonomy is a hierarchical group of policy tags.
///
/// # Configuration
///
/// To configure `PolicyTagManagerSerialization` use the `with_*` methods in the type returned
/// by [builder()][PolicyTagManagerSerialization::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://datacatalog.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::policy_tag_manager_serialization::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::policy_tag_manager_serialization::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `PolicyTagManagerSerialization` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `PolicyTagManagerSerialization` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct PolicyTagManagerSerialization {
    inner: std::sync::Arc<dyn super::stub::dynamic::PolicyTagManagerSerialization>,
}

impl PolicyTagManagerSerialization {
    /// Returns a builder for [PolicyTagManagerSerialization].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_datacatalog_v1::client::PolicyTagManagerSerialization;
    /// let client = PolicyTagManagerSerialization::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::policy_tag_manager_serialization::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::policy_tag_manager_serialization::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::PolicyTagManagerSerialization + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::PolicyTagManagerSerialization>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PolicyTagManagerSerialization> {
        super::transport::PolicyTagManagerSerialization::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::PolicyTagManagerSerialization> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::PolicyTagManagerSerialization::new)
    }

    /// Replaces (updates) a taxonomy and all its policy tags.
    ///
    /// The taxonomy and its entire hierarchy of policy tags must be
    /// represented literally by `SerializedTaxonomy` and the nested
    /// `SerializedPolicyTag` messages.
    ///
    /// This operation automatically does the following:
    ///
    /// - Deletes the existing policy tags that are missing from the
    ///   `SerializedPolicyTag`.
    /// - Creates policy tags that don't have resource names. They are considered
    ///   new.
    /// - Updates policy tags with valid resources names accordingly.
    pub fn replace_taxonomy(
        &self,
    ) -> super::builder::policy_tag_manager_serialization::ReplaceTaxonomy {
        super::builder::policy_tag_manager_serialization::ReplaceTaxonomy::new(self.inner.clone())
    }

    /// Creates new taxonomies (including their policy tags) in a given project
    /// by importing from inlined or cross-regional sources.
    ///
    /// For a cross-regional source, new taxonomies are created by copying
    /// from a source in another region.
    ///
    /// For an inlined source, taxonomies and policy tags are created in bulk using
    /// nested protocol buffer structures.
    pub fn import_taxonomies(
        &self,
    ) -> super::builder::policy_tag_manager_serialization::ImportTaxonomies {
        super::builder::policy_tag_manager_serialization::ImportTaxonomies::new(self.inner.clone())
    }

    /// Exports taxonomies in the requested type and returns them,
    /// including their policy tags. The requested taxonomies must belong to the
    /// same project.
    ///
    /// This method generates `SerializedTaxonomy` protocol buffers with nested
    /// policy tags that can be used as input for `ImportTaxonomies` calls.
    pub fn export_taxonomies(
        &self,
    ) -> super::builder::policy_tag_manager_serialization::ExportTaxonomies {
        super::builder::policy_tag_manager_serialization::ExportTaxonomies::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(
        &self,
    ) -> super::builder::policy_tag_manager_serialization::ListOperations {
        super::builder::policy_tag_manager_serialization::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::policy_tag_manager_serialization::GetOperation {
        super::builder::policy_tag_manager_serialization::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(
        &self,
    ) -> super::builder::policy_tag_manager_serialization::DeleteOperation {
        super::builder::policy_tag_manager_serialization::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(
        &self,
    ) -> super::builder::policy_tag_manager_serialization::CancelOperation {
        super::builder::policy_tag_manager_serialization::CancelOperation::new(self.inner.clone())
    }
}
